<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
// checks to see if password session is set
// if not redirects to ../admin/
if($_SESSION['loggedIn'] == 0 && !isset($adminPage)){
include('../includes/auth.inc.php');
}

if (isset($_POST['cu_updated'])) {
	if (empty($_POST['cu_pfrom'])) {
	$priceFrom = 0.00;
	} else {
	$priceFrom = $_POST['cu_pfrom'];
	}
	if (empty($_POST['cu_plim'])) {
	$priceLimit = 9999999999.99;
	} else {
	$priceLimit = $_POST['cu_plim'];
	}
}


?>













<?php
// category added report
if (isset($_POST['cu_updated'])) {
echo '<fieldset><strong style="color:green">Content Unit Created</strong></fieldset>';
}
?>








<?php if (isset($_POST['cu_updated'])) { ?>

<form action="index.php?ad=cu" method="post" name="showOptions">

<fieldset>
<legend>Content Unit Links</legend>

<strong>JavaScript Code</strong><br />
<textarea name="jsLink" cols="80" rows="4">
<?php
echo '<script type="text/javascript" language="javascript" src="';
echo $installDir['value'].'contentunit.php?as_ps='.$_POST['cu_ps'].'&as_pfrom='.$priceFrom.'&as_plim='.$priceLimit.'&as_cs='.$_POST['cu_cs'].'&as_cp='.$_POST['cu_cp'].'&as_b='.$_POST['cu_b'].'&as_w='.$_POST['cu_w'].'&as_c='.$_POST['cu_c'].'&as_p='.$_POST['cu_p'].'&as_iw='.$_POST['cu_iw'].'&as_ih='.$_POST['cu_ih'].'&as_font='.$_POST['cu_font'].'&as_size='.$_POST['cu_size'].'&as_align='.$_POST['cu_align'].'&as_valign='.$_POST['cu_valign'].'&as_target='.$_POST['cu_target'].'&as_js=1';
echo '"></script>';
?>
</textarea><br /><br />

<strong>iframe URL</strong><br />
<textarea name="iframeLink" cols="80" rows="4"><?php echo $installDir['value'].'contentunit.php?as_ps='.$_POST['cu_ps'].'&as_pfrom='.$priceFrom.'&as_plim='.$priceLimit.'&as_cs='.$_POST['cu_cs'].'&as_cp='.$_POST['cu_cp'].'&as_b='.$_POST['cu_b'].'&as_w='.$_POST['cu_w'].'&as_c='.$_POST['cu_c'].'&as_p='.$_POST['cu_p'].'&as_iw='.$_POST['cu_iw'].'&as_ih='.$_POST['cu_ih'].'&as_font='.$_POST['cu_font'].'&as_size='.$_POST['cu_size'].'&as_align='.$_POST['cu_align'].'&as_valign='.$_POST['cu_valign'].'&as_target='.$_POST['cu_target']; ?></textarea><br /><br />

<strong>PHP Code</strong><br />
<textarea name="phpLink" cols="80" rows="4">
<?php 
echo "<?php \$html = @implode ('', @file ('";
echo $installDir['value'].'contentunit.php?as_ps='.$_POST['cu_ps'].'&as_pfrom='.$priceFrom.'&as_plim='.$priceLimit.'&as_cs='.$_POST['cu_cs'].'&as_cp='.$_POST['cu_cp'].'&as_b='.$_POST['cu_b'].'&as_w='.$_POST['cu_w'].'&as_c='.$_POST['cu_c'].'&as_p='.$_POST['cu_p'].'&as_iw='.$_POST['cu_iw'].'&as_ih='.$_POST['cu_ih'].'&as_font='.$_POST['cu_font'].'&as_size='.$_POST['cu_size'].'&as_align='.$_POST['cu_align'].'&as_valign='.$_POST['cu_valign'].'&as_target='.$_POST['cu_target'];
echo "')); echo \$html; ?>";
?>
</textarea><br /><br />


</fieldset>

<fieldset>
<legend>Example Content Unit</legend>
<!--<?php $html = @implode ('', @file($installDir['value'].'contentunit.php?as_ps='.$_POST['cu_ps'].'&as_pfrom='.$priceFrom.'&as_plim='.$priceLimit.'&as_cs='.$_POST['cu_cs'].'&as_cp='.$_POST['cu_cp'].'&as_b='.$_POST['cu_b'].'&as_w='.$_POST['cu_w'].'&as_c='.$_POST['cu_c'].'&as_p='.$_POST['cu_p'].'&as_iw='.$_POST['cu_iw'].'&as_ih='.$_POST['cu_ih'].'&as_font='.$_POST['cu_font'].'&as_size='.$_POST['cu_size'].'&as_align='.$_POST['cu_align'].'&as_valign='.$_POST['cu_valign'].'&as_target='.$_POST['cu_target']));
echo $html; ?>-->
<script type="text/javascript" language="javascript" src="<?php echo $installDir['value'] ?>contentunit.php?as_ps=<?php echo $_POST['cu_ps'] ?>&as_pfrom=<?php echo $priceFrom ?>&as_plim=<?php echo $priceLimit ?>&as_cs=<?php echo $_POST['cu_cs'] ?>&as_cp=<?php echo $_POST['cu_cp'] ?>&as_b=<?php echo $_POST['cu_b'] ?>&as_w=<?php echo $_POST['cu_w'] ?>&as_c=<?php echo $_POST['cu_c'] ?>&as_p=<?php echo $_POST['cu_p'] ?>&as_iw=<?php echo $_POST['cu_iw'] ?>&as_ih=<?php echo $_POST['cu_ih'] ?>&as_font=<?php echo $_POST['cu_font'] ?>&as_size=<?php echo $_POST['cu_size'] ?>&as_align=<?php echo $_POST['cu_align'] ?>&as_valign=<?php echo $_POST['cu_valign'] ?>&as_target=<?php echo $_POST['cu_target'] ?>&as_js=1"></script>
</fieldset>

</form>









<?php } else { ?>

<form action="index.php?ad=cu" method="post" name="showOptions">

<fieldset>
<legend>Content Unit Settings</legend>

<table cellpadding="4" cellspacing="0" border="0">
<tr>
<td align="left" valign="top">
<label for="cuPs">Product Keywords:</label>
</td>
<td align="left" valign="top">
<input name="cu_ps" type="text" id="cuPs" class="adminInput" value="" /><br />
(eg. keyword1,keyword2,keyword3 etc. separated by commas with no space)
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuPfrom">Price From:</label>
</td>
<td align="left" valign="top">
<input name="cu_pfrom" type="text" id="cuPfrom" class="adminInput" value="" /><br />
(eg. 10.00 or leave blank for none)
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuPlim">Price Limit:</label>
</td>
<td align="left" valign="top">
<input name="cu_plim" type="text" id="cuPlim" class="adminInput" value="" /><br />
(eg. 35.00 or leave blank for none)
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuW">Content Unit Width:</label>
</td>
<td align="left" valign="top">
<input name="cu_w" type="text" id="cuW" class="adminInput" value="600" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuCp">Cellpadding:</label>
</td>
<td align="left" valign="top">
<input name="cu_cp" type="text" id="cuCp" class="adminInput" value="5" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuCs">Cellspacing:</label>
</td>
<td align="left" valign="top">
<input name="cu_cs" type="text" id="cuCs" class="adminInput" value="0" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuB">Content Unit Border:</label>
</td>
<td align="left" valign="top">
<input name="cu_b" type="text" id="cuB" class="adminInput" value="0" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuC">Columns:</label>
</td>
<td align="left" valign="top">
<input name="cu_c" type="text" id="cuC" class="adminInput" value="3" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuP">Number of Products:</label>
</td>
<td align="left" valign="top">
<input name="cu_p" type="text" id="cuP" class="adminInput" value="9" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuIw">Image Width:</label>
</td>
<td align="left" valign="top">
<input name="cu_iw" type="text" id="cuIw" class="adminInput" value="80" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuIh">Image Height:</label>
</td>
<td align="left" valign="top">
<input name="cu_ih" type="text" id="cuIh" class="adminInput" value="80" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuFont">Font:</label>
</td>
<td align="left" valign="top">
<input name="cu_font" type="text" id="cuFont" class="adminInput" value="Verdana" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuSize">Font Size:</label>
</td>
<td align="left" valign="top">
<input name="cu_size" type="text" id="cuSize" class="adminInput" value="12px" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuAlign">Text Align:</label>
</td>
<td align="left" valign="top">
<select name="cu_align" id="cuAlign">
<option value="left" selected="selected">Left</option>
<option value="center">Center</option>
<option value="right">Right</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuValign">Text Vertical Align:</label>
</td>
<td align="left" valign="top">
<select name="cu_valign" id="cuValign">
<option value="top" selected="selected">Top</option>
<option value="middle">Middle</option>
<option value="bottom">Bottom</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top">
<label for="cuTarget">Target Window:</label>
</td>
<td align="left" valign="top">
<select name="cu_target" id="cuTarget">
<option value="_self" selected="selected">_self</option>
<option value="_blank">_blank</option>
<option value="_parent">_parent</option>
<option value="_top">_top</option>
</select>
</td>
</tr>
</table>

</fieldset>



<fieldset>
<input type="hidden" name="cu_updated" value="yes" />
<input value="Create Content Unit" type="submit" class="padSubmit" />
</fieldset>
</form>

<?php } ?>
